#ifndef __ALTAIR_SYSTEM_DATETIME_H__
#define __ALTAIR_SYSTEM_DATETIME_H__

/**
 *  poke()
 *  na adresu <cis>:[<sic>] preda hodnotu <val>
 */
void poke(unsigned int cis, unsigned int sic, int val) {
  asm mov si, sic       ;
  asm mov es, cis       ;
  asm mov ax, val       ;
  asm mov es:[si], ax   ;
}

/**
 *  peek()
 *  z adresy <cis>:[<sic>] vrati hodnotu
 */
unsigned int peek(unsigned int cis, unsigned int sic) {
  asm mov si, sic         ;
  asm mov es, cis         ;
  asm mov ax, es:[si]     ;
  asm jmp next            ;
next:
  return _AX;
}

/**
 *  SetInterruptAt()
 *  nastavi dane cislo interruptu dane funkce
 */
void SetInterruptAt(char IntNo, int handler, int segment) {
  asm cli;  /* prace se stackem */
  poke(0x0000, (IntNo << 2),   handler);
  poke(0x0000, (IntNo << 2)+2, segment);
  asm sti;
}

#endif
